<!--
 * @Author: cheung0
 * @Date: 2021-11-19 13:05:14
-->
<template>
  <el-container style="height: 100%">
    <el-aside width="auto">
      <common-aside></common-aside>
    </el-aside>
    <el-container>
      <el-header>
        <common-header></common-header>
      </el-header>
      <el-main>
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
import CommonAside from "../components/CommonAside.vue";
import CommonHeader from "../components/CommonHeader.vue";
import {createNamespacedHelpers} from 'vuex';
import request from "@/utils/request";


const {mapActions} = createNamespacedHelpers('userlogin');
export default {
  name: "Main",
  components: {CommonAside, CommonHeader},
  methods: {
    ...mapActions(['isLogin']),
  },
  async mounted() {
    if (!(await this.isLogin())) {
      this.$message.error({
        showClose: true,
        message: "请先登录！"
      });
      await this.$router.push({name: "login"});
    }
  },
};
</script>

<style lang="scss" scoped>
.el-header {
  background-color: #333;
}

.el-main {
  padding-top: 0;
}
</style>
